import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor as dtr
from sklearn.tree import DecisionTreeClassifier as dtc
import sklearn.datasets as dts
from sklearn.preprocessing import StandardScaler

x = np.linspace(0, 5, 100).reshape(-1, 1)
y = np.sin(x)

plt.scatter(x, y, s=1, zorder=0)

model01 = dtr(max_depth=5)
model01.fit(x, y)
h = model01.predict(x)
plt.scatter(x, h, marker='x', s=1, zorder=100)

data = dts.load_breast_cancer()
x = data.data  # ATTENTION
y = data.target  # ATTENTION
x = StandardScaler().fit_transform(x)
model02 = dtc(max_depth=5)
model02.fit(x, y)
print(f'score = {model02.score(x, y)}')

plt.show()
